package edu.sctu.zhengsenwen.month201506.day20150611.Array;

/**
 * Created by user15 on 2015/6/12.
 */
public class C04E03 {

    public static void main(String[] args) {

        int a[][] = {{2, 4, 6}, {1, 3, 5}};

        int b[][] = {{2, 4, 3, 5}, {1, 2, 4, 8}, {3, 6, 9, 2}};

        int c[][] = new int[2][4];


        System.out.println("Array_A:");

        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 3; j++) {
                System.out.print(a[i][j] + "\t");
            }
            System.out.println();
        }


        System.out.println("Array_B:");

        for (int i = 0; i < 3; i++) {

            for (int j = 0; j < 4; j++) {

                System.out.print(b[i][j] + "\t");
            }
            System.out.println();

        }


        System.out.println("**********************");


        for (int i = 0; i < 2; i++) {

            for (int j = 0; j < 4; j++) {

                int t = 0;

                for (int k = 0; k < 3; k++) {

                    t = t + a[i][k] * b[k][j];

                    c[i][j] = t;

                }
                System.out.print(c[i][j] + "\t");
            }
            System.out.println();

        }


        System.out.println("Array_C:");

        for (int i = 0; i < 2; i++) {

            for (int j = 0; j < 4; j++) {

                System.out.print(c[i][j] + "\t");

            }
            System.out.println();

        }

    }
}